<!--定义分页请求地址，传递给backConstant.ftl-->
<#assign urllist="${rc.contextPath}/example/bookAdminJsonList" />
<!--定义详情请求地址，传递给backConstant.ftl-->
<#assign urldetail="${rc.contextPath}/example/bookAdminJsonDetail" />
<!--定义添加表单初始值请求地址，传递给backConstant.ftl-->
<#assign urladdforminit="${rc.contextPath}/example/bookAdminJsonAddFormInit" />
<!--定义保存实体变量地址，传递给backConstant.ftl-->
<#assign urlsave="${rc.contextPath}/example/bookAdminJsonSave" />
<!--定义修改实体变量地址，传递给backConstant.ftl-->
<#assign urlupdate="${rc.contextPath}/example/bookAdminJsonUpdate" />
<!--定义删除实体变量地址，传递给backConstant.ftl-->
<#assign urldelete="${rc.contextPath}/example/bookAdminJsonDelete" />
<!--定义恢复实体变量地址，传递给backConstant.ftl-->
<#assign urlrenew="${rc.contextPath}/example/bookAdminJsonRenew" />
<#assign urlclassificationdata="${rc.contextPath}/example/classificationAdminJsonData" />

<!--include常量-->
<#include "/misc/backConstant.ftl">

<script type="text/javascript">
		//设置分页表格的属性
		var paginationColumns = 
			[
			 {field:"name",title:"<@i18n.message "example.book.field.name"/>",width:50},
			 {field:"author",title:"<@i18n.message "example.book.field.author"/>",width:50},
			 {field:"price",title:"<@i18n.message "example.book.field.price"/>",width:50},
			 {field:"description",title:"<@i18n.message "example.book.field.description"/>",width:50},
			 {field:"classification.name",title:"<@i18n.message "example.book.field.classification"/>",width:50},
			 {field:"createdate",title:"<@i18n.message "example.book.field.createdate"/>",width:50}
			];
			 
		//查询
		function doSearch${currentActionName}(){
			$('#' + dg).datagrid('load',{
				"nameSearchKey": $('#nameSearchKey${currentActionName}').val(),
				"classificationSearchKey.id": $('#classificationSearchKey${currentActionName}').combobox('getValue')
		    });
		}
		
		//可以在这里扩充详情的显示
		function detailSet${currentActionName}(result){
		}
		
		$.get("${urlclassificationdata}", function(result) {
			var options = {
				data : result,
				textField:'${CoreConstants.VIEW_SELECT_LABEL_TEXT}',
				valueField:'${CoreConstants.VIEW_SELECT_LABEL_VALUE}'
			};
			$('#classificationSearchKey${currentActionName}').combobox(options);
			$('#classificationFormKey${currentActionName}').combobox(options);
		});
		 
</script>
<script type="text/javascript" src="${rc.contextPath}/static/js/crud.js"></script>

<div style="padding:5px;">
	<table id="dg${currentActionName}"></table>
	<div id="toolbar${currentActionName}"  style="padding:5px;height:auto">
		<div style="margin-bottom:5px">
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="openDetail('detail','${currentActionName}','${urldetail}')"><@i18n.message "button.detail"/></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="openAdd('dlg','fm','${currentActionName}','${urlsave}','${urladdforminit}')"><@i18n.message "button.add"/></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="openEdit('dlg','fm','${currentActionName}','${urlupdate}','${urldetail}')"><@i18n.message "button.edit"/></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="openDelete('${currentActionName}','${urldelete}')"><@i18n.message "button.delete"/></a>
		</div>
		<div>
			<input id="nameSearchKey${currentActionName}" class="easyui-textbox" data-options="prompt:'<@i18n.message "example.book.field.name"/>'"> &nbsp;&nbsp;
			<input id="classificationSearchKey${currentActionName}" class="easyui-combobox" data-options="prompt:'<@i18n.message "example.book.field.classification"/>'"> &nbsp;&nbsp;
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="doSearch${currentActionName}()"><@i18n.message "button.search"/></a>
		</div>
	</div>
	<div id="dlg${currentActionName}" class="easyui-dialog" closed="true" resizable="true" minimizable="true" collapsible="true" maximizable="true" style="width:35%;height:70%;padding:10px 20px"
			 buttons="#dlg-buttons${currentActionName}">
		<div class="ftitle"><@i18n.message "example.book.info"/></div>
			<@spring.form id="fm${currentActionName}" modelAttribute="vm" method="post">
				<div class="fitem">
					<label><@i18n.message "example.book.field.name"/>:</label>
					<input name="name" id="nameFormKey${currentActionName}" class="easyui-textbox" data-options="validType:['length[2,50]']" >
				</div>
				<div class="fitem">
					<label><@i18n.message "example.book.field.author"/>:</label>
					<input name="author" id="authorFormKey${currentActionName}" class="easyui-textbox" data-options="required:true,validType:['length[0,500]']" missingMessage='<@i18n.message "example.book.field.author.required"/>'>
				</div>
				<div class="fitem">
					<label><@i18n.message "example.book.field.price"/>:</label>
					<input name="price" id="priceFormKey${currentActionName}" class="easyui-numberbox">
				</div>
				<div class="fitem">
					<label><@i18n.message "example.book.field.description"/>:</label>
					<input name="description" id="descriptionFormKey${currentActionName}" class="easyui-textbox" data-options="validType:['length[0,500]']" >
				</div>
				<div class="fitem">
					<label><@i18n.message "example.book.field.classification"/>:</label>
					<input name="classification.id" id="classificationFormKey${currentActionName}" class="easyui-combobox" data-options="required:true" missingMessage='<@i18n.message "example.book.field.classification.required"/>'>
				</div>
					<input type="hidden" name="${CoreConstants.TOKEN_KEY}" id="${CoreConstants.TOKEN_KEY}${currentActionName}">
			</@spring.form>
		</div>

	</div>
	<div id="dlg-buttons${currentActionName}">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="save('dlg','fm','${currentActionName}','${urlsave}','${urlupdate}')"><@i18n.message "button.save"/></a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="cancelForm('dlg','fm','${currentActionName}')"><@i18n.message "button.cancel"/></a>
	</div>
	<div id="detail${currentActionName}" class="easyui-dialog" closed="true" resizable="true" minimizable="true" collapsible="true" maximizable="true" style="width:35%;height:70%;padding:10px 20px" buttons="#detail-buttons${currentActionName}">
		<div class="ftitle"><@i18n.message "example.book.info"/></div>
		<table class="window_table">
			<tr>
				<td><@i18n.message "example.book.field.name"/>:</td>
				<td><label id="name${currentActionName}"></label></td>
			</tr>
			<tr>
				<td><@i18n.message "example.book.field.author"/>:</td>
				<td><label id="author${currentActionName}"></label></td>
			</tr>
			<tr>
				<td><@i18n.message "example.book.field.price"/>:</td>
				<td><label id="price${currentActionName}"></label></td>
			</tr>
			<tr>
				<td><@i18n.message "example.book.field.description"/>:</td>
				<td><label id="description${currentActionName}"></label></td>
			</tr>
			<tr>
				<td><@i18n.message "example.book.field.classification"/>:</td>
				<td><label id="classification_name${currentActionName}"></label></td>
			</tr>
			<tr>
				<td><@i18n.message "example.book.field.createdate"/>:</td>
				<td><label id="createdate${currentActionName}"></label></td>
			</tr>
		</table>


	</div>
	<div id="detail-buttons${currentActionName}">
		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="cancelForm('detail',null,'${currentActionName}')"><@i18n.message "button.closed"/></a>
	</div>
</div>